package com.mob.tools.network;

import com.mob.tools.utils.ReflectHelper;
import java.io.InputStream;

public abstract class HTTPPart
{
  private OnReadListener listener;
  private long offset;

  protected abstract InputStream getInputStream()
    throws Throwable;

  public Object getInputStreamEntity()
    throws Throwable
  {
    InputStream localInputStream = toInputStream();
    long l = length() - this.offset;
    ReflectHelper.importClass("org.apache.http.entity.InputStreamEntity");
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = localInputStream;
    arrayOfObject[1] = Long.valueOf(l);
    return ReflectHelper.newInstance("InputStreamEntity", arrayOfObject);
  }

  protected abstract long length()
    throws Throwable;

  public void setOffset(long paramLong)
  {
    this.offset = paramLong;
  }

  public void setOnReadListener(OnReadListener paramOnReadListener)
  {
    this.listener = paramOnReadListener;
  }

  public InputStream toInputStream()
    throws Throwable
  {
    ByteCounterInputStream localByteCounterInputStream = new ByteCounterInputStream(getInputStream());
    localByteCounterInputStream.setOnInputStreamReadListener(this.listener);
    if (this.offset > 0L)
      localByteCounterInputStream.skip(this.offset);
    return localByteCounterInputStream;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.mob.tools.network.HTTPPart
 * JD-Core Version:    0.6.2
 */